﻿using System;

namespace Program05
{
    class Program
    {
        static void Main(string[] args)
        {

            Console.WriteLine("请输入您的性别（男/女）");
            string sex = Console.ReadLine();
            if(sex=="男"||sex=="女")
            {
                Console.WriteLine("请输入您的身高（cm）");
                double height = Convert.ToDouble(Console.ReadLine());
                Console.WriteLine("请输入您的体重(kg)");
                double weight = Convert.ToDouble(Console.ReadLine());
                string a = DetectionWeight(GetStandardWeight(sex, height, weight), weight);
                Console.WriteLine("您的健康状况是：" + a);
                Console.ReadLine();
            }
            else
            {
                Console.WriteLine("请输入错误");
            }
            //if(sex=true)
            //{
            //    num = (height - 80) * 0.7;
            //}
            //else
            //{
            //    num = (height - 70) * 0.6;
            //}
            
        }
        public static double GetStandardWeight(string sex, double height, double weight)//标准体重
        {
            double num = 0;
            if (sex == "男")
            {
                num = (height - 80) * 0.7;
            }
            else if (sex == "女")
            {
                num = (height - 70) * 0.6;
            }
            return num;
        }
        public static string DetectionWeight(double num, double weight)
        {
            string a="";
            //if ((weight - num) > 0)
            //{
                if (weight <= num + (num * 0.1) && weight >= num - (num * 0.1))
                {
                    a = "正常体重";
                }
                else if (weight <= num - (num * 0.1) && weight >= num - (num * 0.2))
                {
                    a = "体重过轻";
                }
                else if (weight >= num + (num * 0.1) && weight <= num + (num * 0.2))
                {
                    a = "体重过重";
                }
                else if (weight < num - (num * 0.2))
                {
                    a = "体重不足";
                }
                else if (weight > num + (num * 0.2))
                {
                    a = "肥胖";
                }                
            //}
            return a;
        }
    }
}
